import axios from 'axios';

const API_KEY = 'e3ea166a3414065baa5045a5dc8e6c02';
const URL = `http://apilayer.net/api/live?access_key=${API_KEY}&currencies=CNY,HKD&source=USD&format=1`;
export function getExchangeRate() {
    return axios.get(URL).then((response) => {
        if (response.status === 200) {
            return response.data.quotes;
        }
        return Promise.reject(new Error(`status ${response.status}`));
    });
}
